using System.Collections.Generic;
using Moq;
using NUnit.Framework;
using RMH.DataAccess;
using RMH.Entities;
using RMH.Services;

namespace RMH.UnitTests.Services
{
    [TestFixture]
    public class PatientServices_when_searching_for_entity : base_automock_test
    {
        IList<Patient> patients = new List<Patient>();
        IList<Patient> returnedPatients;
        private string firstName = "Gob";
        private string lastName = "Bluth";


        public override void establish_context()
        {
            Mock<IPatientRepository>()
                .Setup(s => s.FindAll(                    
                    It.Is<IDictionary<string, object>>(match => match.ContainsKey("FirstName") && match.ContainsKey("LastName"))))
                .Returns(patients);
        }
        public override void because()
        {
            returnedPatients = Create<PatientService>().Search(firstName, lastName);                
        }

        [Test]
        public void patient_search_results_are_retrieved_from_the_repository()
        {
            patients.ShouldEqual(returnedPatients);            
        }

        
    }
}